package com.dankegongyu.demo.http.http;

/**
 * @author wpq
 * @version 1.0
 */
public class HttpException extends RuntimeException {

    public HttpException() {
        super("服务器繁忙");
    }

    public HttpException(String message) {
        super(message);
    }

    public HttpException(int code) {
        super(getMessageBySpecialCode(code));
    }

    /**
     * 处理特殊code
     */
    private static String getMessageBySpecialCode(int code) {
        String message;
        switch (code) {
            case 500:
                message = "服务器繁忙";
                break;
            default:
                message = "未知错误";
                break;
        }
        return message;
    }
}
